package com.sanyang.pda.dialog;

import android.content.Context;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.wangshen.base.dialog.base.BaseDialog;
import com.wangshen.projectbase.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class ConfrimDialog extends BaseDialog {
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.tv_cancel)
    TextView tvCancel;
    @BindView(R.id.tv_confirm)
    TextView tvConfirm;
    private Onclick onclick;

    public ConfrimDialog(@NonNull Context context, Onclick onclick) {
        super(context);
        this.onclick = onclick;
    }

    @Override
    public void initView() {
        ButterKnife.bind(this);
    }

    @Override
    public void initData() {

    }


    public void show(String title) {
        super.show();
        tvTitle.setText(title);
    }

    @Override
    public int getView() {
        return R.layout.dialog_confrim;
    }

    @OnClick(R.id.tv_cancel)
    public void onTvCancelClicked() {
        dismiss();
    }

    @OnClick(R.id.tv_confirm)
    public void onTvConfirmClicked() {
        if (onclick != null){
            onclick.onConfirm();
            dismiss();
        }
    }

    public static interface Onclick {
        void onConfirm();
    }
}